package estore.web_servlet;

import mybatis.dao.Mybatis;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "regist")
public class registServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                String username=request.getParameter("user");
                String password=request.getParameter("password");
                String sex=request.getParameter("sex");
                String age=request.getParameter("age");
                String email=request.getParameter("emial");
                String [] hobby=request.getParameterValues("hobby");
                String jianjie=request.getParameter("jianjie");
                System.out.println(hobby.length);
                PersonBean person=new PersonBean(username,password,sex,age,email,jianjie,hobby[0],hobby[1],hobby[2]);
                try {
                    Mybatis s=new Mybatis();
                    s.add_regist(person);
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }
}
